export class JsonResult {
    code: number;
    msg: string;
    data: any;

    static getError(msg: string = '验证未通过，操作被中断！'): JsonResult {
        const ret = new JsonResult();
        ret.code = -1;
        ret.msg = msg;
        ret.data = null;

        return ret;
    }

    constructor(data?: any) {
        this.code = 1;
        this.data = data;
    }
}


export class ZorroOption {
    label: string;
    value: string;
}


/**
 * ng-zorro-antd 表格控件点击列头进行排序时
 * 传递给自定义方法的数据模型
 * 调用方法：<thead (nzSortChange)="sort($event)" nzSingleSort>
 * 参数 $event 的模型即为本模型
 */
export class NzSort {
    key: string; // 点击的表格列的字段名称
    value: string; // ascend,descend
}


/**
 * ng-zorro-antd 表格控件列过滤的下拉数据模型
 */
export class NzFilterOpts {
    text: string;
    value: string;
}

/**
 * 执行过滤的依据：
 * fieldName：过滤的字段
 * opts:string[]：多选过滤依据 - 数组
 */
export class NzFilterReference{
    fieldName: string;
    opts: any;
}

//#region 选中行：行号 + UUID
export class SelectedRow{
  rowIndex:number;
  uuid:string;
}
//#endregion

// 使用：select * from information_schema.COLUMNS WHERE table_schema='gsms' AND table_name='bill_main';
//       查询获取指定表的字段信息的模型类
export class MySQLColumnInfo{
    TABLE_CATALOG:string;
    TABLE_SCHEMA:string;
    TABLE_NAME:string;
    COLUMN_NAME:string;
    ORDINAL_POSITION:number;
    COLUMN_DEFAULT:string;
    IS_NULLABLE:string;
    DATA_TYPE:string;
    CHARACTER_MAXIMUM_LENGTH:number;
    CHARACTER_OCTET_LENGTH:number;
    NUMERIC_PRECISION:number;
    NUMERIC_SCALE:number;
    DATETIME_PRECISION:number;
    CHARACTER_SET_NAME:string;
    COLLATION_NAME:string;
    COLUMN_TYPE:string;
    COLUMN_KEY:string;
    EXTRA:string;
    PRIVILEGES:string;
    COLUMN_COMMENT:string;
    GENERATION_EXPRESSION:string;
}


/**
 * 服务器中MYSQL的所有数据库的所有表的所有字段
 * 构建了一个自增的主键
 */
export class ServerField{
    auto_key:number;
    schema_name:string;
    table_name:string;
    table_comment:string;
    column_name:string;
    column_type:string;
    data_type:string;
    column_comment:string;
    extra:string;
    column_key:string;
}